summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/document-list-only/page.tsx
diff options
context:
space:
mode:
author0-Zz-ang <s1998319@gmail.com>2025-08-17 23:05:19 +0900
committer0-Zz-ang <s1998319@gmail.com>2025-08-17 23:05:19 +0900
commit5adc1df95f80fbec7a0b5bbee15448b10d5aec3a (patch)
treec748910aacb05f13e335f9afa39eb9d763f88d7c /app/[lng]/evcp/(evcp)/document-list-only/page.tsx
parent6013fe51293ea067400e6b3b26691705608eba22 (diff)
(박서영)evcp/document-list-only, evcp/vendor-data 생성
Diffstat (limited to 'app/[lng]/evcp/(evcp)/document-list-only/page.tsx')
-rw-r--r--app/[lng]/evcp/(evcp)/document-list-only/page.tsx98
1 files changed, 98 insertions, 0 deletions
diff --git a/app/[lng]/evcp/(evcp)/document-list-only/page.tsx b/app/[lng]/evcp/(evcp)/document-list-only/page.tsx
new file mode 100644
index 00000000..5b49a6ef
--- /dev/null
+++ b/app/[lng]/evcp/(evcp)/document-list-only/page.tsx
@@ -0,0 +1,98 @@
+// evcp/document-list-only/page.tsx - 전체 계약 대상 문서 목록
+import * as React from "react"
+import { Suspense } from "react"
+import { Skeleton } from "@/components/ui/skeleton"
+import { type SearchParams } from "@/types/table"
+import { getValidFilters } from "@/lib/data-table"
+import { DocumentStagesTable } from "@/lib/vendor-document-list/plant/document-stages-table"
+import { documentStageSearchParamsCache } from "@/lib/vendor-document-list/plant/document-stage-validations"
+import { getDocumentStagesOnly } from "@/lib/vendor-document-list/plant/document-stages-service"
+
+interface IndexPageProps {
+ searchParams: Promise<SearchParams>
+}
+
+// 문서 테이블 래퍼 컴포넌트 (전체 계약용)
+async function DocumentTableWrapper({
+ searchParams
+}: {
+ searchParams: SearchParams
+}) {
+ const search = documentStageSearchParamsCache.parse(searchParams)
+ const validFilters = getValidFilters(search.filters)
+
+ // 필터 타입 변환
+ const convertedFilters = validFilters.map(filter => ({
+ id: (filter.id || filter.rowId) as string,
+ value: filter.value,
+ operator: (filter.operator === 'iLike' ? 'ilike' :
+ filter.operator === 'notILike' ? 'notin' :
+ filter.operator === 'isEmpty' ? 'eq' :
+ filter.operator === 'isNotEmpty' ? 'ne' :
+ filter.operator === 'isBetween' ? 'eq' :
+ filter.operator === 'isRelativeToToday' ? 'eq' :
+ filter.operator || 'eq') as 'eq' | 'in' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'like' | 'ilike' | 'notin'
+ }))
+
+ // evcp: 전체 계약 대상으로 문서 조회
+ const documentsPromise = getDocumentStagesOnly({
+ ...search,
+ filters: convertedFilters,
+ }, -1) // 세션에서 자동으로 도메인 감지
+
+ return (
+ <DocumentStagesTable
+ promises={Promise.all([documentsPromise])}
+ contractId={-1} // 전체 계약을 의미
+ projectType="plant" // 기본값으로 plant 사용
+ />
+ )
+}
+
+function TableLoadingSkeleton() {
+ return (
+ <div className="space-y-4">
+ <div className="flex items-center justify-between">
+ <Skeleton className="h-6 w-32" />
+ <div className="flex items-center gap-2">
+ <Skeleton className="h-8 w-20" />
+ <Skeleton className="h-8 w-24" />
+ </div>
+ </div>
+ <div className="rounded-md border">
+ <div className="p-4">
+ <div className="space-y-3">
+ {Array.from({ length: 5 }).map((_, i) => (
+ <div key={i} className="flex items-center space-x-4">
+ <Skeleton className="h-4 w-4" />
+ <Skeleton className="h-4 w-24" />
+ <Skeleton className="h-4 w-48" />
+ <Skeleton className="h-4 w-20" />
+ <Skeleton className="h-4 w-16" />
+ <Skeleton className="h-4 w-12" />
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+// 메인 페이지 컴포넌트
+export default async function DocumentStagesManagementPage({
+ searchParams
+}: IndexPageProps) {
+ const resolvedSearchParams = await searchParams
+
+ return (
+ <div className="mx-auto">
+ {/* 문서 테이블 */}
+ <Suspense fallback={<TableLoadingSkeleton />}>
+ <DocumentTableWrapper
+ searchParams={resolvedSearchParams}
+ />
+ </Suspense>
+ </div>
+ )
+} \ No newline at end of file